package com.qingzhuge.entity;

import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

/**
 * @author : zero.xiao
 * @description : 简单的抽象基础类，指定id类型Long，声明一个创建时间属性，用于简单功能类
 * @date :2018/6/7 0007 上午 9:34
 * @modified :
 */
@Setter
@Getter
@MappedSuperclass
public abstract class BasePkLongEntity extends BaseBriefnessEntity<Long> {
    private static final long serialVersionUID = 9021761868355096137L;

    @Id
    @Column(length = 32)
    @GeneratedValue(generator = "idLongGenerate")
    @GenericGenerator(name = "idLongGenerate", strategy = "com.qingzhuge.dao.id.IdLongGenerate")
    private Long id;

    public BasePkLongEntity() {
        super();
    }

    public BasePkLongEntity(String name) {
        super(name);
    }

    public BasePkLongEntity(Long id) {
        this.id = id;
    }

    public BasePkLongEntity(String name, Long id) {
        super(name);
        this.id = id;
    }
    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
    }

}
